package com.gxsf.wechatbook.repo;

import com.gxsf.wechatbook.pojo.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;


/**
 * @author BlueStar http://www.bluestardt.com
 * @version 1.0.0
 * @date 2021/1/18 18:04
 */
public interface UserRepository extends JpaRepository<User, Long> {
    @Transactional
    @Modifying(clearAutomatically = true)
    @Query("UPDATE User u set u.scope=100 where u.scope<100")
    void updateAllUserScope();

    User findByPhone(long phone);
}
